let arr = ["Ilya", "Kantor"];

//解构赋值
// 将数组解构到变量
let [firstName, surName] = arr;
// 或者
let [firstName1, surName1] = "Ilya Kantor".split(' ');

alert(firstName);
alert(surName);


// 忽略使用的逗号
let [firstName2, , ,title] = ["Julius", "Caesar", "Consul", "of the Roman Republic"]

alert(title);       // should output 'of the Roman Republic'


// actually, the right side of equal symbol can be any Iterable Object
let [a, b, c] = "abc";

let [one, two, three] = new Set([1, 2, 3]);


// and we also can assignment value to any thing at the left side of equal symbol
let user = {};

[user.name, user.surname] = "Ilya Kantor".split(' ');

alert(user.name);